package com.itcoon.cloud.framework.webmvc.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;

import java.io.Serializable;

public class AbstractResponse<T> implements Serializable {

    private static final long serialVersionUID = -1020878851729309383L;

    /**
     * 响应编码
     */
    @Schema( description = "响应结果编码")
    @JsonProperty
    private String code;

    /**
     * 结果消息
     */
    @Schema(description = "响应结果消息")
    @JsonProperty
    private String message;

    /**
     * 响应主体
     */
    @Schema(description = "返回数据主体，载荷")
    @JsonProperty
    private T data;

    public AbstractResponse() {
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "AbstractResponse{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
